import { getToken } from "../utils/auth"
import user from "../store/user"
import Cookies from "js-cookie"
/**
 * 验证用户身份信息的中间件
 */
 export default function ({ app, redirect, store }) {
  // If the user is not authenticated
  // console.log('中间件验证身份信息', app.$cookies.get('info'))
  const userInfo = store.state.user.info
  const token = store.state.user.token
  // console.log('tokentokentokentoken', store.state.user)
  if (!token || userInfo?.user_type == 2 || userInfo?.user_type == 3) {
    redirect('/home')
  }
}
